import request from '@/utils/request'

// 查询提派单列表
export function listDispatch(query) {
  return request({
    url: '/shipment/dispatch/list',
    method: 'get',
    params: query
  })
}

// 查询提派单详细
export function getDispatch(id) {
  return request({
    url: '/shipment/dispatch/' + id,
    method: 'get'
  })
}

// 新增提派单
export function addDispatch(data) {
  return request({
    url: '/shipment/dispatch',
    method: 'post',
    data: data
  })
}

// 修改提派单
export function updateDispatch(data) {
  return request({
    url: '/shipment/dispatch',
    method: 'put',
    data: data
  })
}

// 删除提派单
export function delDispatch(id) {
  return request({
    url: '/shipment/dispatch/' + id,
    method: 'delete'
  })
}

// 开始执行
export function startDispatch(ids) {
  return request({
    url: '/shipment/dispatch/startExe/' + ids,
    method: 'post'
  })
}

// 完成执行
export function completeDispatch(ids) {
  return request({
    url: '/shipment/dispatch/endExe/' + ids,
    method: 'post'
  })
}

// 异常修改
export function dispatchSaveAbnormal(data) {
  return request({
    url: '/shipment/dispatch/saveAbnormal',
    method: 'put',
    data: data
  })
}
